﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1.StateManagement.Cookies
{
    public partial class Page1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnGo_Click(object sender, EventArgs e)
        {
            HttpCookie cookie = new HttpCookie("mycookie");
            cookie.Name = "userName";
            cookie.Value = txtname.Text;
            cookie.Expires = DateTime.Now.AddSeconds(20);
            Response.Cookies.Add(cookie);
            Application["myApp"] = txtname.Text;
            Response.Redirect(@"~\StateManagement\Cookies\Page2.aspx");
        }
    }
}